package edu.chalmers.mde.schedulesystem;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.LinkedList;

public class MapParserImpl implements MapParser{

	@Override
	public Map fileToMap(File mapFile)   {
		LinkedList<Route> list = new LinkedList<Route>();
		Map a = new Map(list);
		try {
			FileReader fr = new FileReader(mapFile);
			BufferedReader br = new BufferedReader(fr);
			String str = br.readLine();
			System.out.println("The route is:" );
			while(str!=null){
				String routeLine[] = str.split(",");
				for(String s : routeLine){
					System.out.println(s);
				}
				
				str = br.readLine();
			}
			fr.close();
			br.close();
			
		} catch (IOException e) {
			System.out.println("This file does not exist!");
			
		}
		return a;
	}
	public static void main(String[] args) {
		MapParser mp = new MapParserImpl();
		mp.fileToMap(new File("D:/workspace/scheduling_System/simpleMap.txt"));
		
	}
}

